 <!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    

    <title>{$Think.config.site.title} - 退款审批</title>

    <meta name="keywords" content="{$Think.config.site.keywords}">

    <link href="{$Think.config.site.resource_url}css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/animate.min.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/style.min.css?v=4.0.0" rel="stylesheet">

</head>
<style>
.seltime{width: 200px; display:inline-block; float: right; margin-right: 20px;}
.timebox{display: inline-block; float: right;}
.timebox .time{float: left; border:1px solid #e5e6e7; padding: 0 8px}
.timebox .time label{ font-size: 14px; font-weight: normal;}
.start_time,.end_time{border: none; text-align: center; height: 30px; line-height: 30px; }
.timebox button{border-radius: 0 4px 4px 0px ; height: 32px;}
.selt{height:32px;}

#listtable .fa{
	cursor:pointer;
	color:#1ab394;
	margin-right:1em;
}
th .tag{font-size: 12px; color: #e66c6c; font-weight: normal;}
.ibox-title .tag{font-size: 12px; color: #e66c6c; font-weight: normal; display: inline-block; margin-left: 20px;}
.specval-hide{display: none;}
th,td{text-align: center;}
.select_sort{cursor: pointer;}
.text-r{text-align: right !important;}
.text-l{text-align: left !important;}
</style>
<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">

      <div class="row">
          <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>退款审批列表</h5>
                        <!-- <span class="tag">说明：</span> -->
                    </div>
                    <div class="ibox-content">
                        <div class="row">
                        	<div class="col-sm-6">
                                <a type="button" class="btn btn-primary btn-sm " href="{:url('export',['start_time'=>$w['start_time'],'end_time'=>$w['end_time']])}" target="_blank">导出</a>
                        	</div>
                          	<div class="col-sm-6">
                                <div class="input-group pull-right">
                                <form id="fsearch" action="{:url('refuselist')}" method="get" enctype="application/x-www-form-urlencoded">
                                    <!-- <div class="input-group">
                                        <input type="text" placeholder="收货人姓名/电话/订单号" class="input-sm form-control" value="{$Think.get.keywords ?? ''}" name="keywords">
                                    </div> -->
                                    <div class="timebox">
                                        <div class="time">
                                            <label>开始时间：</label>
                                            <input class="start_time" id="start_time" value="{$w.start_time}" type="text" name="start_time" readonly="true">
                                            <label>结束时间：</label><input type="text" class="end_time" id="end_time" name="end_time" value="{$w.end_time}" readonly="true">
                                        </div>
                                        <button type="submit" class="btn btn-sm btn-primary"> 搜索</button>
                                    </div>
                                    <div class="seltime">
                                    <select class="form-control selt" name="selt">
                                        <option value='0' {eq name="w.selt" value='0'} selected="selected" {/eq}  >快捷操作</option>
                                        <option value='1' {eq name="w.selt" value='1'} selected="selected" {/eq}  >今天</option>
                                        <option value='2' {eq name="w.selt" value='2'} selected="selected" {/eq}  >昨天</option>
                                        <option value='3' {eq name="w.selt" value='3'} selected="selected" {/eq}  >前天</option>
                                        <option value='4' {eq name="w.selt" value='4'} selected="selected" {/eq}  >本周</option>
                                        <option value='5' {eq name="w.selt" value='5'} selected="selected" {/eq}  >上周</option>
                                        <option value='6' {eq name="w.selt" value='6'} selected="selected" {/eq}  >本月</option>
                                        <option value='7' {eq name="w.selt" value='7'} selected="selected" {/eq}  >上月</option>
                                        <option value='10' {eq name="w.selt" value='10'} selected="selected" {/eq}  >最近3天</option>
                                        <option value='8' {eq name="w.selt" value='8'} selected="selected" {/eq}  >最近7天</option>
                                        <option value='9' {eq name="w.selt" value='9'} selected="selected" {/eq}  >最近30天</option>
                                    </select>
                                    </div>
                                </form>
                                </div>
                            </div>
                            
                        </div>
                        <div class="table-responsive">
                            <table class="table table-striped" id="listtable">
                                <thead>
                                    <tr>
                                        <th width="150">提交时间</th>
                                        <th width="150">审核时间</th>
                                        <th  class="text-l">退款理由</th>
                                        <th width="150" class="text-r">退款金额</th>
                                        <th width="300">相关订单</th>
                                        <th width="300">结果</th>
                                    </tr>
                                </thead>
                                <tbody>

                                	{volist name="list" id="v"}
                                    {volist name="v['list']" id="vo"}
                                    <tr data-id="{$vo.audit_id}">
                                        <td>{$vo.create_time}</td>
                                        <td>{$vo.audit_time}</td>
                                        <td class="text-l">{$vo.remark}</td>
                                        <td class="text-r money">￥{$vo.money}</td>
                                        <td>{$vo.order.order_no}<br/>{$vo.order.receiver_name} {$vo.order.receiver_mobile}</td>
                                        <td>
                                        	{if($vo['audit_status']==2)}
                                        		已退款
                                        	{elseif($vo['audit_status']==-1)}
                                        		已拒绝
                                        	{else}
                                        		未知
                                        	{/if}
                                        </td>
                                    </tr>
                                    {/volist}
                                    <tr style="background: #f5abab" >
                                        <td colspan="3" class="text-r">{$v.time}号统计：</td>
                                        <td class="text-r">￥{$v.count}</td>
                                        <td></td>
                                        <td></td>
                                    </tr>
                                   {/volist}
                                </tbody>
                            </table>
                        </div>
                        <div>{$page}</div>
                    </div>
                </div>
            </div>

        </div>
    </div>

    <script src="{$Think.config.site.resource_url}js/jquery.min.js?v=2.1.4"></script>
    <script src="{$Think.config.site.resource_url}js/bootstrap.min.js?v=3.3.5"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/peity/jquery.peity.min.js"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/iCheck/icheck.min.js"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/layer/layer.js"></script>
    <script src="{$Think.config.site.common_resource_url}js/majax.js"></script>
    <script src="{$Think.config.site.common_resource_url}js/jedit.js"></script>

    <script src="{$Think.config.site.common_resource_url}js/laydate/laydate.js"></script>
    <script src="{$Think.config.site.common_resource_url}js/getDateRange.js"></script>
</body>

</html>
<script>

var layer_font='';
var $editTr;
$(document).ready(function() {
    $('.selt').change(function(){
        var val=$(this).val();
        var st=$('.start_time');
        var et=$('.end_time');
        switch(parseInt(val))
        {
            case 1:st.val(getCurrentDate);et.val(getCurrentDate);break;
            case 2:st.val(getYesterdayDate);et.val(getYesterdayDate);break;
            case 3:st.val(getpdayDate);et.val(getpdayDate);break;
            case 4:st.val(getWeekStartDate);et.val(getWeekEndDate);break;
            case 5:st.val(getUpWeekStartDate);et.val(getUpWeekEndDate);break;
            case 6:st.val(getMonthStartDate);et.val(getMonthEndDate);break;
            case 7:st.val(getLastMonthStartDate);et.val(getLastMonthEndDate);break;
            case 8:st.val(getSevenStartDate);et.val(getSevenEndDate);break;
            case 9:st.val(getThirtyStartDate);et.val(getThirtyEndDate);break;
            case 10:st.val(getThreeStartDate);et.val(getThreeEndDate);break;
            default: return false;break;
        }
        $('#fsearch').submit();
    });

    var start = {
        elem: '#start_time',
        format: 'YYYY-MM-DD hh:mm',
        // min: laydate.now(), //设定最小日期为当前日期
        max: '2099-06-16 23:59:59', //最大日期
        istime: true,
        istoday: true,
        choose: function(datas){
            $('.selt option:eq(0)').attr('selected','selected');
            // end.min = datas; //开始日选好后，重置结束日的最小日期
            // end.start = datas //将结束日的初始值设定为开始日
        }
    };
    var end = {
        elem: '#end_time',
        format: 'YYYY-MM-DD hh:mm',
        // min: laydate.now(),
        max: '2099-06-16 23:59:59',
        istime: true,
        istoday: true,
        choose: function(datas){
            $('.selt option:eq(0)').attr('selected','selected');
            // start.max = datas; //结束日选好后，重置开始日的最大日期
        }
    };
    laydate.skin('molv'); 
    laydate(start);
    laydate(end);
});	

$('.agree').click(function(){
    var money = $(this).closest('tr').find('.money').text(),id = $(this).closest('tr').data('id');
    layer.confirm('审核通过将自动退款'+money+'元', {
            btn: ['确定','取消'], //按钮
            // shade: 0, //不显示遮罩
            title:'提示'
        }, function(){
            //确定删除
            majax('{:url("agree")}',{id:id},function(d){
                if (d.code>0) {
                    
                }else{
                    layer.msg(d.msg, {icon: 5});
                }
            })
        },
        function(){
            
        }
    );
})
</script>